package kr.saeildamil.androidstudy.ch13;

import kr.saeildamil.androiddforstudy.R;
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.View;
import android.widget.ScrollView;

public class ScrollViewTest extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch13_scrollviewtest);
		
		ScrollView sv = (ScrollView) findViewById(R.id.ch13_scrollviewtest_scroll);
		sv.addView(new ColorView(this));
	}
}

class ColorView extends View{
	public ColorView(Context context){
		super(context);
	}

	public void onDraw(Canvas canvas){
		Paint pnt = new Paint();
		for(int i=0; i<2560; i += 10){
			pnt.setARGB(255, 255-i/10, 255-i/10, 255);
			canvas.drawRect(0, i, 2560, i+10, pnt);
		}
	}
	
	@Override
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		setMeasuredDimension(2560, 2560);
	}
	
}
